//
//  SplashView.m
//  HelloWorld
//
//  Created by jing zhao on 11/26/14.
//
//

#import "SplashView.h"

@interface SplashView ()

@property(strong,nonatomic)UIActivityIndicatorView *activity;

@end


@implementation SplashView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        //imageview
        UIImageView *imageview =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Default.png"]];
        [self addSubview:imageview];
        imageview.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
        
        //activity
        UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:  UIActivityIndicatorViewStyleWhiteLarge];
        [self addSubview:activity];
        self.activity = activity;
        
        // Initialization code
    }
    return self;
}

-(void)setViewFrame:(CGRect)frame
{
    self.frame=frame;
    CGRect rectScreen = [[UIScreen mainScreen]bounds];
    self.activity.center=CGPointMake(self.center.x,rectScreen.size.height*0.9) ;
}


-(void)show
{
    self.hidden = NO;
    self.activity.hidden=NO;
    [self.activity startAnimating];

}

-(void)hide
{
    self.hidden = YES;
    self.activity.hidden = YES;
    [self.activity stopAnimating];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
